<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>userList</title>
    <link rel="stylesheet" th:href="@{/css/bootstrap.css}">

</head>
<body class="container">
<br/>
<h1>用户列表</h1>
<br/><br/>
<table class="table table-striped">
    <thead>
    <tr>
        <th scope="col">ID</th>
        <th scope="col">账号</th>
        <th scope="col">年龄</th>
        <th scope="col">地址</th>
        <th scope="col">上司</th>
        <th scope="col">修改</th>
        <th scope="col">删除</th>
    </tr>
    </thead>
    <tbody>
    <tr th:each="user : ${staffList}">
        <th scope="row" th:text="${userStat.index + 1}">1</th>
        <td th:text="${user.username}">neo</td>
        <td th:text="${user.age}">6</td>
        <td th:text="${user.address}">6</td>
        <td th:text="${user.admin.name}">6</td>
        <td><a th:href="@{/generator/staff/updatePage(id=${user.id})}">edit</a></td>
        <td><a th:href="@{/generator/staff/delete(id=${user.id})}">delete</a></td>
    </tr>
    </tbody>
</table>

</div>
<div class="form-group">
    <div class="col-sm-2 control-label">
        <a href="/generator/staff/toAdd"  class="btn btn-info">add</a>
    </div>
</div>

<div class="modal-footer no-margin-top">
    <ul class="pagination pull-right no-margin">

        <!-- 首页 -->
        <li>
            <a th:href="'/generator/staff/list?pageNum=0'">首页</a>
        </li>

        <!-- 上一页 -->
        <li th:if="${staffDtoPage.hasPrevious()}">
            <a th:href="'/generator/staff/list?pageNum=' + ${staffDtoPage.pages}" th:text="上一页"></a>
        </li>

        <!-- 中间页 -->
        <li th:each="pageNum:${#numbers.sequence(0, staffDtoPage.getTotal() - 1)}">
            <a th:href="'/generator/staff/list?pageNum=' + ${pageNum+1}" th:text="${pageNum + 1}" th:if="${pageNum ne staffDtoPage.getPages()+1}"></a>
            <a th:href="'/generator/staff/list?pageNum=' + ${pageNum+1}" th:text="${pageNum + 1}" th:if="${pageNum eq staffDtoPage.getPages()+1}" th:style="'font-weight:bold;background: #6faed9;'"></a>
        </li>

        <!-- 下一页 -->
        <li th:if="${staffDtoPage.hasNext()}">
            <a th:href="'/generator/staff/list?pageNum=' + ${staffDtoPage.getPages()+1}" th:text="下一页"></a>
        </li>

        <!-- 尾页 -->
        <li>
            <a th:href="'/generator/staff/list?pageNum=' + ${staffDtoPage.getTotal()- 1}">尾页</a>
        </li>

    </ul>
</div>

</body>

</html>